This is a package simplification from PhotomossR. This set of R functions enables to measure plant area and estimates photosynthetic activity using the NDVI.
This document is a tutorial to show how to use the package.
First of all we need a working directory structure as shown in (Figure 2.1).
JPG folder: in our case with Orange + Cyan + NIR in JPG format (Figure 2.2).
rois folder: contains binary masks with .tif rasters obtained with ImageJ. This mask allow us to obtain the area of interest from JPG pictures pictures were we want to calculate NDVI. Observe that each tif need to be in a subfolder. Mask file and subfolder need to have the same name as sample file (Figure 2.3.)
Figure 2.1: Working directory structure.
Figure 2.2: Orange + Cyan + NIR image example. We need to incluide a color chart that we will use to calibrate color levels.
Figure 2.3: Mask example obtained from imageJ. White area delimitates the area where we want to calculate NDVI.
We install CIDE package.
## install librarian
if(require(librarian)==F){
install.packages("librarian")
library(librarian)
}else{
library(librarian)
}
## Loading required package: librarian
# install required packages an libraries
librarian::shelf(MMolbus/CIDE, MMolbus/MButils )
##
## The 'cran_repo' argument in shelf() was not set, so it will use
## cran_repo = 'https://cran.r-project.org' by default.
##
## To avoid this message, set the 'cran_repo' argument to a CRAN
## mirror URL (see https://cran.r-project.org/mirrors.html) or set
## 'quiet = TRUE'.
Set working directory and define picture and roi folders
# define your working directory
wd <- "./my_wd"
setwd(wd)
# define sample picture (JPG) directory
pic_wd <-
list.dirs(wd, recursive = T)[
grep("JPG$", list.dirs(wd, recursive = T))
]
# define (mask) directory
roi_wd <-
list.dirs(wd, recursive = T)[
grep("rois$", list.dirs(wd, recursive = T))
]
summary(cars)
## speed dist
## Min. : 4.0 Min. : 2.00
## 1st Qu.:12.0 1st Qu.: 26.00
## Median :15.0 Median : 36.00
## Mean :15.4 Mean : 42.98
## 3rd Qu.:19.0 3rd Qu.: 56.00
## Max. :25.0 Max. :120.00
You can also embed plots, for example:
Note that the echo = FALSE parameter was added to the code chunk to prevent printing of the R code that generated the plot.